var app = getApp();
var c = require('../common.js');
Page({

      /**
       * 页面的初始数据
       */
      data: {
        imgUrls: [
          'http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg',
          'http://img06.tooopen.com/images/20160818/tooopen_sy_175866434296.jpg',
          'http://img06.tooopen.com/images/20160818/tooopen_sy_175833047715.jpg'
        ],
      },

      /**
       * 生命周期函数--监听页面加载
       */
      onLoad: function(options) {

        wx.previewImage
        var demandid = options.demandid;
        this.setData({
          filePath: app.testimgurl
        })
        c.ajax(
          app.url + 'describeinfo', {
            demandid: demandid
          },
          res => {
            console.log(233333);
            console.log(res.data.datao[0]);
            this.setData({
              datao: res.data.datao[0],
              long: res.data.datao[0].voice_time * 20,
              datat: res.data.datat
            })
          }
        )
      },

      /**
       * 生命周期函数--监听页面初次渲染完成
       */
      onReady: function() {

      },

      /**
       * 生命周期函数--监听页面显示
       */
      onShow: function() {

      },

      /**
       * 生命周期函数--监听页面隐藏
       */
      onHide: function() {

      },

      /**
       * 生命周期函数--监听页面卸载
       */
      onUnload: function() {

      },

      /**
       * 页面相关事件处理函数--监听用户下拉动作
       */
      onPullDownRefresh: function() {

      },

      /**
       * 页面上拉触底事件的处理函数
       */
      onReachBottom: function() {

      },

      /**
       * 用户点击右上角分享
       */
      onShareAppMessage: function() {

      },
      avdiov: function(e) {
        var filePath = this.data.filePath;
        var path = filePath + e.currentTarget.dataset.vurl;
        const innerAudioContext = wx.createInnerAudioContext()
        console.log(path);
        // var path = this.data.sendAudioList;
        innerAudioContext.autoplay = true;
        innerAudioContext.src = path;
        innerAudioContext.onPlay(() => {
          console.log('开始播放')
        })
        innerAudioContext.onError((res) => {
          console.log(res.errMsg)
          console.log(res.errCode)
        })
      },
      previewImage: function(e) {
        var current = [e.target.dataset.imgsrc];
        
        wx.previewImage({
          urls: current // 需要预览的图片http链接列表
        })

      }
      })